fix: use os.walk to build custom components on Python 3.10 and 3.11#6760
Open
anxkhn wants to merge 1 commit into
Open
fix: use os.walk to build custom components on Python 3.10 and 3.11#6760anxkhn wants to merge 1 commit into
anxkhn wants to merge 1 commit into
Conversation
`reflex component build` generates .pyi files for the custom component by walking its source tree in `_make_pyi_files`. That loop used `pathlib.Path.walk()`, which was only added in Python 3.12, so on Python 3.10 and 3.11 (both supported by `requires-python = ">=3.10,<4.0"`) the build crashed with `AttributeError: 'PosixPath' object has no attribute 'walk'`. Switch the walk to `os.walk()`, mirroring the existing `_walk_files` helper in reflex-base whose comment already notes `Path.walk()` cannot be used until the floor is 3.12. `PyiGenerator.scan_all` accepts str or Path targets, so the yielded directory strings work unchanged. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Contributor
Greptile SummaryThis PR restores custom-component builds on Python 3.10 and 3.11. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "fix: use os.walk to build custom compone..." | Re-trigger Greptile |
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AttributeError: 'PosixPath' object has no attribute 'walk'
Towncrier / CHANGELOG fragment
Committed
news/6714.bugfix.md(placeholder number6714) to satisfy theCHANGELOG CI gate (
.github/workflows/changelog.yml), which requires a towncrierfragment for any change under
reflex/. Verified locally:uv run towncrier check --config pyproject.toml --dir . --compare-with origin/main-> exit 0.
ACTION AFTER OPENING THE PR: rename
news/6714.bugfix.mdtonews/<real-PR-number>.bugfix.mdand amend/commit.6714was the plausible nextnumber at draft time (latest activity was #6711-#6713), but the true PR number
is only known once the PR exists. Note
news/6710.bugfix.mdalready exists in thetree, so if the real PR lands on a number already taken by another fragment,
pick the actual PR number regardless.